<template>
  <view class="container">
    <view class="header">
      <text class="menu-icon">☰</text>
      <text class="title">胜利</text>
      <text class="cart-icon">🛒</text>
    </view>
    <view class="search-bar">
      <input type="text" placeholder="搜索所需要的产品" />
      <button class="search-button">🔍</button>
    </view>
    <view class="content">
      <view class="categories">
        <view class="category-item" v-for="(item, index) in categories" :key="index">
          <text>{{ item }}</text>
        </view>
      </view>
      <view class="product-list">
        <view class="product-item" v-for="(product, index) in products" :key="index">
          <image :src="product.image" mode="aspectFill" class="product-image"></image>
          <view class="product-info">
            <text class="product-name">{{ product.name }}</text>
            <text class="product-price">¥{{ product.price }}</text>
          </view>
          <view class="cart-button">
            <text>🛒</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      categories: [
        '生鲜水果',
        '新鲜时蔬',
        '粮调味干货',
        '农家自打油',
        '禽畜肉蛋',
        '手工物品',
        '中药材',
        '农副加工'
      ],
      products: [
        {
          image: '/static/images/product.jpg', // 更新为实际的图片路径
          name: '打枣子',
          price: 50.00
        },
		{
		  image: '/static/images/product.jpg', // 更新为实际的图片路径
		  name: '你好',
		  price: 50.00
		},
		
        // 可以添加更多商品
      ]
    };
  }
};
</script>

<style>
.container {
  display: flex;
  flex-direction: column;
  padding: 20rpx;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10rpx;
  background-color: #fff;
}
.menu-icon, .cart-icon {
  font-size: 24rpx;
}
.title {
  font-size: 32rpx;
  font-weight: bold;
}
.search-bar {
  display: flex;
  justify-content: center;
  margin-top: 20rpx;
}
input {
  width: 80%;
  padding: 10rpx;
  border-radius: 10rpx;
  border: 1px solid #ccc;
}
.search-button {
  margin-left: 10rpx;
  padding: 10rpx 20rpx;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 10rpx;
}
.content {
  display: flex;
  margin-top: 20rpx;
}
.categories {
  width: 20%;
  margin-right: 20rpx;
}
.category-item {
  margin-bottom: 20rpx;
  text-align: center;
}
.product-list {
  width: 80%;
  display: flex;
  flex-wrap: wrap;
}
.product-item {
  width: 45%;
  margin: 10rpx;
  background-color: #fff;
  padding: 10rpx;
  border-radius: 10rpx;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.product-image {
  width: 100%;
  height: 150rpx;
  margin-bottom: 10rpx;
  border-radius: 10rpx;
}
.product-info {
  text-align: center;
}
.product-name {
  font-size: 28rpx;
  font-weight: bold;
}
.product-price {
  color: #f60;
  font-size: 32rpx;
}
.cart-button {
  margin-top: 10rpx;
}
</style>